\section{The dynamics of a spacecraft}

\begin{frame}{\thesection.\ \insertsection}
Spacecraft are free bodies, possessing both translational and rotational motion. \\
\vspace{20pt}
\begin{description}
    \item[\textcolor{blue}{Orbita}l dynamics]The translational component is the subject of orbital dynamics.
    \item[\textcolor{blue}{Attitude dynamics}]The rotational component is the subject of attitude dynamics.
\end{description}
\vspace{20pt}
It will be seen that the two classes of motion are essentially uncoupled, and can be treated separately.
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Physical vectors}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
A physical quantity consists of:
\begin{itemize}
\item vectors:
    \begin{itemize}
    \item[\mysquare] \textcolor{blue}{a magnitude}
    \item[\mysquare] \textcolor{blue}{a direction}
    \end{itemize}
\item scalars:
    \begin{itemize}
    \item[\mysquare] \textcolor{blue}{a magnitude}
    \end{itemize}
\end{itemize}
\begin{center}\includegraphics{fig_7_1.pdf}\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.1:} Physical vector\end{center}
A physical vector
\begin{itemize}
    \item is denoted as $\vec r$.
    \item can be represented graphically by an arrow.
\end{itemize}
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
Operation:
\begin{description}
    \item[\textcolor{blue}{Addition}:] head-to-tail.
\end{description}
\begin{center}\includegraphics{fig_7_2.pdf}\end{center}
\begin{center}
\textcolor{blue}{Figure \arabic{section}.2:} Physical vector addition\end{center}
\begin{description}
    \item[\textcolor{blue}{Multiplication of vector \(\vec{r}\) by a scalar \(a\)}] \textcolor{blue}{:}
    \begin{itemize}
    \item Magnitude: scales the magnitude by \(|a|\).
    \item Direction: if \(a\) is positive, the direction is unchanged; if \(a\) is negative, the direction is reversed.
    \end{itemize}
    \item[\textcolor{blue}{Scalar product}: ]given vectors \(\vec{a}\) and \(\vec{b}\), the scalar (of dot) product between the two vectors is defined as
\[ \vec{a} \cdot \vec{b} \triangleq |\vec{a}| |\vec{b}| \cos \theta \]
where \(0 \leq \theta \leq 180^\circ\) is the small angle between the two vectors.
\end{description}
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
\begin{description}
    \item[\textcolor{blue}{Vector cross product}:]
 given vectors \(\vec{a}\) and \(\vec{b}\), the cross-product is defined as a vector \(\vec{c}\), denoted by \(\vec{c} = \vec{a} \times \vec{b}\) with \textcolor{blue}{magnitude}
\[ |\vec{a} \times \vec{b}| \triangleq |\vec{a}| |\vec{b}| \sin \theta \]
with a \textcolor{blue}{direction} perpendicular to both \(\vec{a}\) and \(\vec{b}\), chosen according to the right-hand rule.
\end{description}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Reference frames and physical vector coordinates}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
\begin{itemize}\setlength{\itemsep}{10pt}
    \item For computational purposes we need to introduce the concept of a reference frame.
    \item Reference frames are also needed to describe the orientation of an object, and are needed for the formulation of kinematics and dynamics.
\end{itemize}
\begin{center}\includegraphics{fig_7_3.pdf}\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.3:} Reference frame\end{center}
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
To define a reference frame, say reference frame ``1'' (which we will label \(\mathcal{F}_1 \)), it is customary to identify three mutually perpendicular unit length (length of one) physical vectors, labeled as \(\vec{x}_1\), \(\vec{y}_1\), \(\vec{z}_1\) respectively.
\begin{center}\includegraphics{fig_7_4.pdf}\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.4:} Reference frame\end{center}
These three vectors then define the reference frame.
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
Now, since the three unit vectors form a basis for physical three-dimensional space, any physical vector \(\vec{r}\) can be written as a linear combination of the unit vectors, that is
\[ \vec{r} = r_{x,1}\vec{x}_1 + r_{y,1}\vec{y}_1 + r_{z,1}\vec{z}_1 \]
\begin{center}\includegraphics{fig_7_5.pdf}\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.5:} Physical vector\end{center}
\(r_{x,1}\), \(r_{y,1}\), \(r_{z,1}\) are the \textcolor{blue}{coordinates} of the vector \(\vec{r}\) in reference frame \(\mathcal{F}_1\).
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
\vspace{-2pt}
Denote the column matrix containing the \textcolor{blue}{coordinates} of \( \vec{r} \) in \( \mathcal{F}_1 \) as
\vspace{-2pt}
\[
r_1 =
\begin{bmatrix}
r_{x,1} \\
r_{y,1} \\
r_{z,1}
\end{bmatrix}
\]
\vspace{-2pt}
and the column matrix containing the unit physical vectors defining \( \mathcal{F}_1 \) as
\vspace{-2pt}
\[
\vec{\mathcal{F}}_1 =
\begin{bmatrix}
\vec{x}_1 \\
\vec{y}_1 \\
\vec{z}_1
\end{bmatrix}
\]
\vspace{-2pt}
Then,
\vspace{-2pt}
\[
\vec{r} = \vec{\mathcal{F}}_1^T r_1
\]
\vspace{-8pt}
\begin{center}\includegraphics{fig_7_5.pdf}\end{center}
\vspace{-6pt}
\begin{center}\textcolor{blue}{Figure \arabic{section}.6:} Physical vector\end{center}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Rotation matrices}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
Spacecraft dynamics problems generally involve the use of several reference frames.
\begin{itemize}
    \item For example, to describe the orientation of the spacecraft with respect to the Earth, it makes sense to fix one reference (say \( \mathcal{F}_1 \)) to the Earth, and the other (say \( \mathcal{F}_2 \)) to the spacecraft body.
    \item The orientation of the spacecraft with respect to the Earth can then be described by the orientation of reference frame \( \mathcal{F}_2 \) with respect to \( \mathcal{F}_1 \).
\end{itemize}
\begin{block}{Definition \arabic{section}.1}
    \textit{In spacecraft terminology, we call the orientation the \textcolor{red}{attitude}}.
\end{block}
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
Let us now consider two reference frames, \( \mathcal{F}_1 \) defined by the unit vectors \( \vec{x}_1 \), \( \vec{y}_1 \) and \( \vec{z}_1 \), and \( \mathcal{F}_2 \) defined by the unit vectors \( \vec{x}_2 \), \( \vec{y}_2 \) and \( \vec{z}_2 \).
\begin{center}\includegraphics{fig_7_7.pdf}\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.7:} Multiple reference frames\end{center}
Let us also consider an arbitrary vector \( \vec{r} \). Let us now express the vector in each frame as
\[ \vec{r} = \vec{\mathcal{F}}_1^T r_1 = \vec{\mathcal{F}}_2^T r_2 \]
where \( r_1 \) and \( r_2 \) contain the coordinates of the vector \( \vec{r} \) in the reference frames \( \mathcal{F}_1 \) and \( \mathcal{F}_2 \) respectively.
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
Left-multiply both sides by $\vec{\mathcal{F}}_2$ and arrive at
\[ \vec{\mathcal{F}}_2 \cdot \vec{\mathcal{F}}_1^T r_1 = \vec{\mathcal{F}}_2 \cdot \vec{\mathcal{F}}_2^T r_2 \]
Denote
\[
C_{21} = \vec{\mathcal{F}}_2 \cdot \vec{\mathcal{F}}_1^T =
\begin{bmatrix}
\vec{x}_2 \cdot \vec{x}_1 & \vec{x}_2 \cdot \vec{y}_1 & \vec{x}_2 \cdot \vec{z}_1 \\
\vec{y}_2 \cdot \vec{x}_1 & \vec{y}_2 \cdot \vec{y}_1 & \vec{y}_2 \cdot \vec{z}_1 \\
\vec{z}_2 \cdot \vec{x}_1 & \vec{z}_2 \cdot \vec{y}_1 & \vec{z}_2 \cdot \vec{z}_1
\end{bmatrix}
\]
and consider that \( \vec{\mathcal{F}}_2 \cdot \vec{\mathcal{F}}_2^T = I \), yielding
\[
r_2 = C_{21} r_1
\]
\begin{block}{Definition \arabic{section}.2}
    \textit{The matrix \( C_{21} \) is called a \textcolor{red}{rotation matrix}}.
\end{block}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Principal rotations}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
\begin{block}{Definition \arabic{section}.3}
    \textit{\textcolor{red}{Principal rotations} are the rotations about the coordinate axes}.
\end{block}
\begin{center}
    \includegraphics{fig_7_8_1.pdf}
    \includegraphics{fig_7_8_2.pdf}
    \includegraphics{fig_7_8_3.pdf}
\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.8:} Principal rotations\end{center}
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
When \( \mathcal{F}_2 \) is obtained from \( \mathcal{F}_1 \) by a rotation about the z-axis,
the associated rotation matrix is
\[
C_z(\theta_z) =
\begin{bmatrix}
\cos\theta_z & \sin\theta_z & 0 \\
-\sin\theta_z & \cos\theta_z & 0 \\
0 & 0 & 1
\end{bmatrix}
\]
The subscript ``z'' denotes the rotation about the z-axis by an angle $\theta_z$.
For rotations about y-axis and x-axis:
\[
C_y(\theta_y) =
\begin{bmatrix}
\cos\theta_y & 0 & -\sin\theta_y \\
0 & 1 & 0 \\
\sin\theta_y & 0 & \cos\theta_y
\end{bmatrix}\]
\[
C_x(\theta_x) =
\begin{bmatrix}
1 & 0 & 0 \\
0 & \cos\theta_x & \sin\theta_x \\
0 & -\sin\theta_x & \cos\theta_x
\end{bmatrix}
\]
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{General rotations}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
Euler’s theorem was obtained by Leonhard Euler in 1775.
\begin{columns}
\column{0.45\textwidth}
\begin{center}\includegraphics[scale=0.25]{fig_7_9.jpg}\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.9:} Leonhard Euler\end{center}
\column{0.45\textwidth}
\begin{center}\includegraphics{fig_7_10.pdf}\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.10:} General rotation\end{center}
\end{columns}
\begin{block}{Theorem \arabic{section}.1}
\textit{The most general motion of a rigid body with one point fixed is a rotation about an axis through that point}.
\end{block}
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
Let us define two frames \( \mathcal{F}_1 \) and \( \mathcal{F}_2 \).
\begin{columns}
\column{0.45\textwidth}
\begin{center}\includegraphics[scale=0.8]{fig_7_10.pdf}\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.11:} General rotation\end{center}
\column{0.45\textwidth}
\[
a^\times\triangleq
\begin{bmatrix}
0 & -a_z & a_y \\
a_z & 0 & -a_x \\
-a_y & a_x & 0
\end{bmatrix}
\]
\end{columns}
\vspace{10pt}
Denote the axis as $\vec a$, and the rotation angle as $\phi$.
\[ \vec{a} = \mathcal{F}_1^{\mathrm{T}} a \]
where $a$ is the coordinate of $\vec a$ in the frame $\mathcal{F}_1$. \\
Then the rotation matrix can be expressed as:
\[ C_{12} = \cos \phi I + (1 - \cos \phi) a a^{\mathrm{T}} + \sin \phi a^\times \]
where $a^\times$ is the cross-product operator matrix corresponding to a.
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Euler angles}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
\begin{block}{Definition \arabic{section}.4}
    \textit{\textcolor{red}{Euler angles} describe three successive principal rotations}.
\end{block}
For example, a possible sequence is
\begin{enumerate}
    \item A rotation \(\psi\) about the original z-axis (called a ``yaw'' rotation)
    \item A rotation \(\theta\) about the intermediate y-axis (called a ``pitch'' rotation)
    \item A rotation \(\phi\) about the transformed x-axis (called a ``roll'' rotation)
\end{enumerate}
\begin{center}\includegraphics{fig_7_12.pdf}\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.12:} Euler rotation sequence\end{center}
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
This is a very common choice in aerospace applications, and is called a \textcolor{blue}{3-2-1 attitude sequence}. \\
\vspace{10pt}
The terminology relates to the order of rotations.
\begin{enumerate}
    \item A principal z-axis (labeled 3) rotation is first,
    \item followed by a principal y-axis (labeled 2) rotation,
    \item followed by a principal x-axis (labeled 1) rotation.
\end{enumerate}
\vspace{10pt}
In this case, the rotation matrix from frame \( \mathcal{F}_1 \) to frame \( \mathcal{F}_2 \) is given by
\begin{align*}
    C_{21}(\phi, \theta, \psi) =& C_x(\phi)C_y(\theta)C_z(\psi) \\
    =&\begin{bmatrix}
    c_\theta c_{\psi} & c_\theta s_{\psi} & -s_\theta \\
    s_\phi s_\theta c_{\psi} - c_\phi s_{\psi} & s_\phi s_\theta s_{\psi} + c_\phi c_{\psi} & s_\phi c_\theta \\
    c_\phi s_\theta c_{\psi} + s_\phi s_{\psi} & c_\phi s_\theta s_{\psi} - s_\phi c_{\psi} & c_\phi c_\theta
\end{bmatrix} \\
\end{align*}
where \( s_b = \sin b \) and \( c_b = \cos b \).
\vspace{10pt}
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
An unfortunate consequence of using Euler angles to describe the rotation matrix is that \textcolor{blue}{a singularity occurs}.
\begin{itemize}
    \item that is, a rotation for which the three parameters cannot be uniquely determined.
\end{itemize}
\vspace{20pt}
For the 3-2-1 sequence above, the \textcolor{blue}{singularity} occurs when the pitch angle is \(\theta = \pm 90^\circ\).
\begin{itemize}
    \item For example, when \(\theta = 90^\circ\), the rotation matrix becomes
    \[C_{21}(\phi, 90^\circ, \psi) =
    \begin{bmatrix}
    0 & 0 & -1 \\
    \sin(\phi - \psi) & \cos(\phi - \psi) & 0 \\
    \cos(\phi - \psi) & -\sin(\phi - \psi) & 0
    \end{bmatrix}\]
\end{itemize}
In this case, the roll and yaw angles (\(\phi\) and \(\psi\)) can not be determined uniquely.
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Quaternions}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
To define the quaternion, we first need to reexamine the rotation matrix in terms of the principal axis $a$ and angle $\phi$ of rotation. We have
\[
C_{21} = \cos \phi I + (1 - \cos \phi) aa^T - \sin \phi a^\times
\]
Let us now make use of the trigonometric identities, and rewrite the rotation matrix as
\[
C_{21} = \left( 2 \cos^2 \frac{\phi}{2} - 1 \right) I + 2 \sin^2 \frac{\phi}{2} aa^T - 2 \sin \frac{\phi}{2} \cos \frac{\phi}{2} a^\times
\]
\textcolor{blue}{Based on this, we now define a vector and scalar part of the quaternion as}
\[
\color{blue}\epsilon = a \sin \frac{\phi}{2}, \quad \eta = \cos \frac{\phi}{2}
\]
\textcolor{blue}{where}
\[\color{blue}
\epsilon =
\begin{bmatrix}
\epsilon_1 \\
\epsilon_2 \\
\epsilon_3
\end{bmatrix}
\]
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Angular velocity}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
Let us consider a second reference frame \( \mathcal{F}_2 \), which is rotating with respect to \( \mathcal{F}_1 \) with angular velocity \( \vec{\omega} \).
\begin{center}\includegraphics{fig_7_13.pdf}\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.13:} Angular velocity\end{center}
We can have the kinematics in terms of the Euler angles:
\[
\begin{bmatrix}
\dot{\phi} \\
\dot{\theta} \\
\dot{\psi}
\end{bmatrix} =
\begin{bmatrix}
1 & \sin \phi \tan \theta & \cos \phi \tan \theta \\
0 & \cos \phi & -\sin \phi \\
0 & \sin \phi \sec \theta & \cos \phi \sec \theta
\end{bmatrix} \omega
\]
where \( \vec{\omega} = \vec{\mathcal{F}}_2^T \omega \).
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
We can have the kinematics in terms of the quaternions:
\begin{align*}
    & \dot{\epsilon} = \frac{1}{2} (\eta I + \epsilon^\times) \omega \\
    & \dot{\eta} = -\frac{1}{2} \epsilon^T \omega \\
\end{align*}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Rigid body}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
Generally, spacecraft structures have some flexibility (that is, they can elastically deform). \\
\vspace{12pt}
However, often times they can be approximated as rigid bodies (that is, they cannot deform).
\vspace{12pt}
\begin{block}{Definition \arabic{section}.5}
    \textit{A rigid body is a continuum in which the distance between any two points on the body remains fixed}.
\end{block}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Rotational dynamics}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
\begin{center}\includegraphics[scale=0.5]{fig_7_14.pdf}\end{center}
\begin{center}\textcolor{blue}{Figure \arabic{section}.14:} Modeling rotational dynamics of a rigid body\end{center}
\begin{block}{Definition \arabic{section}.6}
\textit{The quantity}
\[I \triangleq -\int_V \rho^\times \rho^\times \, \text dm\]
\textit{is called the moment of inertia matrix about the center of mass}, \( c \).
\end{block}
The total external torque applied to the body about \( c \) is
\[\vec{_{}T}_c = \int_V \vec{\rho} \times \vec{f}\text dV\]
\end{frame}

\begin{frame}{\thesection.\ \insertsection \\ \small\thesection.\thesubsection\ \insertsubsection}
The dynamics of the rigid body, which is known as Euler’s equation, is
\[I \dot{\omega} + \omega^\times I \omega = T_c\]
\end{frame}
